package com.ruoyi.web.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LinYuZhenProduct;
import com.ruoyi.system.service.ILinYuZhenProductService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 林钰浈数据产品信息Controller
 * 
 * @author ruoyi
 * @date 2025-11-06
 */
@RestController
@RequestMapping("/system/product1")
public class LinYuZhenProductController extends BaseController
{
    @Autowired
    private ILinYuZhenProductService linYuZhenProductService;

    /**
     * 查询林钰浈数据产品信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:product1:list')")
    @GetMapping("/list")
    public TableDataInfo list(LinYuZhenProduct linYuZhenProduct)
    {
        startPage();
        List<LinYuZhenProduct> list = linYuZhenProductService.selectLinYuZhenProductList(linYuZhenProduct);
        return getDataTable(list);
    }

    /**
     * 导出林钰浈数据产品信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:product1:export')")
    @Log(title = "林钰浈数据产品信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LinYuZhenProduct linYuZhenProduct)
    {
        List<LinYuZhenProduct> list = linYuZhenProductService.selectLinYuZhenProductList(linYuZhenProduct);
        ExcelUtil<LinYuZhenProduct> util = new ExcelUtil<LinYuZhenProduct>(LinYuZhenProduct.class);
        util.exportExcel(response, list, "林钰浈数据产品信息数据");
    }

    /**
     * 获取林钰浈数据产品信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:product1:query')")
    @GetMapping(value = "/{productId}")
    public AjaxResult getInfo(@PathVariable("productId") Long productId)
    {
        return success(linYuZhenProductService.selectLinYuZhenProductByProductId(productId));
    }

    /**
     * 新增林钰浈数据产品信息
     */
    @PreAuthorize("@ss.hasPermi('system:product1:add')")
    @Log(title = "林钰浈数据产品信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LinYuZhenProduct linYuZhenProduct)
    {
        return toAjax(linYuZhenProductService.insertLinYuZhenProduct(linYuZhenProduct));
    }

    /**
     * 修改林钰浈数据产品信息
     */
    @PreAuthorize("@ss.hasPermi('system:product1:edit')")
    @Log(title = "林钰浈数据产品信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LinYuZhenProduct linYuZhenProduct)
    {
        return toAjax(linYuZhenProductService.updateLinYuZhenProduct(linYuZhenProduct));
    }

    /**
     * 删除林钰浈数据产品信息
     */
    @PreAuthorize("@ss.hasPermi('system:product1:remove')")
    @Log(title = "林钰浈数据产品信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{productIds}")
    public AjaxResult remove(@PathVariable Long[] productIds)
    {
        return toAjax(linYuZhenProductService.deleteLinYuZhenProductByProductIds(productIds));
    }
}
